<?php

declare(strict_types=1);

namespace App\CustHub\Amqp\Producers;

use Hyperf\Amqp\Annotation\Producer;
use Hyperf\Amqp\Message\ProducerMessage;

#[Producer(exchange: "hyperf_exchange")]
class RobotMsgProducers extends ProducerMessage
{
    public function __construct($data, $delay = 0 ,$priority = 'low')
    {

        if ($priority === 'high') {
            $this->setRoutingKey('hyperf_high_priority');
        } else {
            $this->setRoutingKey('hyperf_low_priority');
        }

        $this->payload = [
            'data' => $data,
            'delay' => $delay,
        ];
    }

}